log := thirdparty/log/log.c thirdparty/log/log.h
log_test: test/log_test.c $(log)
	gcc  $^ -o $@ -I thirdparty
	./$@
	rm  $@
#$^依赖列表
# $@目标文件

json:= thirdparty/json/cJSON.c thirdparty/json/cJSON.h
cjson_test: test/cjson_test.c $(json) $(log)
	gcc  $^ -o $@ -I thirdparty
	./$@
	rm  $@


app_common:= app/app_common.c app/app_common.h
app_common_test: test/app_common_test.c $(app_common) $(log)
	gcc $^ -o $@ -I thirdparty -Iapp
	./$@
	rm $@


	
app_mqtt:= app/app_mqtt.c app/app_mqtt.h
app_mqtt_test: test/app_mqtt_test.c $(app_mqtt) $(log)
	gcc $^ -o $@ -I thirdparty -Iapp -lpaho-mqtt3c
	./$@
	rm $@
 
app_pool:= app/app_pool.c app/app_pool.h
test/app_pool_test: test/app_pool_test.c $(log) $(app_pool)
	-$(CC) -o $@ $^ -Ithirdparty -Iapp -pthread -lrt
	-./$@
	-rm ./$@

app_buffer := app/app_buffer.h app/app_buffer.c
app_buffer_test: test/app_buffer_test.c $(app_buffer) $(log)
	-$(CC) $^ -o $@ -Ithirdparty -Iapp
	-./$@
	-rm $@


app_bt:=app/app_bt.c app/app_bt.h
app_message:= app/app_message.c app/app_message.h
app_device:= app/app_device.c app/app_device.h
app_device_test: test/app_device_test.c $(app_device) $(app_bt) $(log) $(app_buffer) $(app_message) $(app_common) $(json) $(app_pool) $(app_mqtt)
	-$(CC) -o $@ $^ -Ithirdparty -Iapp -lpaho-mqtt3c -pthread -lrt
	-./$@
	-rm $@